package com.Babysleep.Activity;

import com.Babysleep.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;

public class NullActivity extends Activity implements AnimationListener {

	Intent intent;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		new MyHandler().sendEmptyMessageDelayed(1, 800);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.empty);
		Log.i("TAG", String.valueOf(getIntent().getIntExtra("name", 1)));
		// new MyHandler().sendEmptyMessageDelayed(1, 800);
	}

	class MyHandler extends Handler {

		@Override
		public void handleMessage(Message msg) {
			// TODO Auto-generated method stub
			super.handleMessage(msg);
			switch (getIntent().getIntExtra("name", 0)) {
			case 0:
				intent = new Intent(getApplicationContext(), YaoLanQu.class);
				intent.putExtra("name", 0);
				startActivity(intent);
				overridePendingTransition(R.anim.donghua_left_in,
						R.anim.donghua_left_out);
				break;
			case 4:
				intent = new Intent(getApplicationContext(), MaMaShuo.class);
				intent.putExtra("name", 4);
				startActivity(intent);

				overridePendingTransition(R.anim.donghua2_right_in,
						R.anim.donghua2_right_out);
				break;
			default:
				break;
			}

		}

	}

	@Override
	public void onAnimationEnd(Animation animation) {
		Intent intent = new Intent(getApplicationContext(), YaoLanQu.class);
		startActivity(intent);
		overridePendingTransition(R.anim.donghua_left_in,
				R.anim.donghua_left_out);
		// TODO Auto-generated method stub

	}

	@Override
	public void onAnimationRepeat(Animation animation) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onAnimationStart(Animation animation) {
		// TODO Auto-generated method stub

	}

}
